package com.gr.service.impl;

import com.gr.entity.User;
import com.gr.dao.UserMapper;
import com.gr.service.UserService;
import com.gr.util.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

public class UserServiceImpl implements UserService {
    @Override
    public User login(String username, String password) {
        User user=null;
        SqlSession session = null;
        try {
            session = MybatisUtils.getSession();
            UserMapper um = session.getMapper(UserMapper.class);
            user=um.login(username,password);

        } finally {
            MybatisUtils.closeSession(session);
        }
        return user;
    }
}
